import request  from '@/utils/request';

import { BASE_URL, OPS_URL, USER_URL } from '@/config/query';

export async function queryPage(params = { pageSize: 10, pageNum: 1 }) {
  return request(`${BASE_URL}/task_rules/page`, params)
}

export async function queryInfoById(id) {
  return request(`${BASE_URL}/task_rules/detail/${id}`)
}

export async function create(params) {
  return request(`${BASE_URL}/task_rules/create`, params)
}

export async function update(params) {
  return request(`${BASE_URL}/task_rules/modify`, params)
}

// 批量删除
export async function rulesRemove(params) {
  return request(`${BASE_URL}/task_rules/delete`, params)
}

// 启用
export async function relusEnable(params) {
  return request(`${BASE_URL}/task_rules/enable`, params)
}

// 停用
export async function relusDisable(params) {
  return request(`${BASE_URL}/task_rules/disable`, params)
}

// 查询设备列表
export async function queryDevicePage(params) {
  return request(`${BASE_URL}/device/page`, {...params})
}

// 分页查人员
export async function queryPersonPage(params = { pageSize: 10, pageNum: 1 }) {
  return request(`${OPS_URL}/user/page`, params)
}

// 任务规则目标关联分页查
export async function queryTaskRuleTargetPage(params = { pageSize: 10, pageNum: 1 }) {
  return request(`${BASE_URL}/task_rule_target/page`, params)
}

// 任务规则目标关联详情查
export async function queryRuleTargetDetail(id) {
  return request(`${BASE_URL}/task_rule_target/page/${id}`)
}
